package com.opal.modules.costReportForm.exception;

import com.opal.consts.WSC;
import com.opal.domain.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.rmi.activation.ActivationException;

/**
 * 流程全局异常
 */
@ControllerAdvice
public class ActivitiException {

    @ExceptionHandler(ActivationException.class)
    @ResponseBody
    public R activationException(Exception e){
        String message = e.getMessage();
        if (message.equals("Unknown property used in expression")){
            return new R(WSC.PRECONDITIONFAILED,"必须的值未赋值:"+message);
        }
        return new R(WSC.PRECONDITIONFAILED,"暂时未捕获需要完善:"+message);
    }

}
